#include "MIRPParser.hpp"
#include "mirp.hpp"
#include "log.hpp"




bool MIRPParser::parse()
{
    auto &paser = this->m_paser;
    if (paser.open())
    {
        LOG("open file success\n");

        while (!paser.isEOF())
        {
            size_t udp_data_len = 0;
            uint8_t *udp = paser.getUDP("192.168.48.91", "239.3.151.91", &udp_data_len);
            if (udp && udp_data_len > 0)
            {
                UdpPacketHeader *udp_header = (UdpPacketHeader *)udp;
                this->put(udp + sizeof(UdpPacketHeader), udp_data_len);
            }
            else
            {
                // LOG("get udp failed\n");
            }
        }
        m_mirp_header = (MIRPHeader *)m_content.data();
        return true;
    }
    return false;
}
